package kcore;

import cn.hutool.Hutool;
import cn.hutool.core.lang.Console;
import cyb.CoLocation;
import cyb.POI;
import cyb.Properties;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static cyb.CoLocation.getPOIFromFile;

public class ttest {
    public static void main(String[] args) throws IOException {
        Map<String, POI> poiMap = getPOIFromFile(Properties.maxNum);

        Map<String, Map<String, String>> neighborMap = new HashMap<>();
        List<String> neighborStrList = Files.readAllLines(Paths.get(CoLocation.neighborPath));

        for (String str : neighborStrList) {
            String[] split = str.split(":");
            String starId = split[0];
            if (split.length > 1) {
                Map<String, String> neighborTypeMap = new HashMap<>();
                for (String neighborId : split[1].split(",")) {
                    POI neighborPoi = poiMap.get(neighborId);
                    String neighborType = neighborPoi.getType();

                    String neighborStr = neighborTypeMap.get(neighborType);
                    if (neighborStr == null) {
                        neighborStr = neighborId;
                    } else {
                        neighborStr = neighborStr + "," + neighborId;
                    }
                    neighborTypeMap.put(neighborType, neighborStr);
                }
                if (neighborTypeMap.size() != 0) {
                    neighborMap.put(starId, neighborTypeMap);
                }
            } else {// 将没有邻居的poi点筛除
                poiMap.remove(starId);
            }
        }
        System.out.println(1);
    }
}
